using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using CodeFx.Web;

namespace Code1
{
    public static class CultureHelper
    {
        public const string en = "en-US";
        public const string fr = "fr-FR";
        public static bool IsCultureSet
        {
            get
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies[ConstantesBase.Persistance.Login];
                return ((cookie != null) && (cookie["culture"] != null));
            }
        }

        public static string Culture
        {
            get
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies[ConstantesBase.Persistance.Login];
                if ((cookie != null) && (cookie["culture"] != null))
                    return cookie["culture"];
                else
                    return string.Empty;
            }
            set
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies[ConstantesBase.Persistance.Login];
                if (cookie == null)
                {
                    cookie = new HttpCookie(ConstantesBase.Persistance.Login);
                    cookie["culture"] = value;
                    HttpContext.Current.Response.Cookies.Add(cookie);
                }
                else
                {
                    cookie["culture"] = value;
                    HttpContext.Current.Response.SetCookie(cookie);
                }
            }
        }

    }
}
